/**
 * applet1.java
 * Display a sample applet in an embeded applet window, or within the
 * Java appletviewer application. Write a report that explains the
 * relationship best.
 *
 * Applet1.html has-a applet1 class (Composition). The Applet1.html page and
 * the applet1 class have the same lifetime, and custody. When the web page
 * is rendered, the applet lives, when the web page is closed or the browser
 * is closed, the applet closes (terminates) with the Applet1.html page.
 *
 * Therefore, the relationship between the html page and the embeded applet
 * is a 'has-a' relationship (Compostion).
 *
 * The applet1 class inherits from it's parent Applet. Applet is part of the
 * java.applet package, and it's parent is Panel, and has one known subclass
 * JApplet. Applet implements the following interfaces: ImageObserver,
 * MenuContainer, Serializable, and Accessible.
 *
 * Our applet1 class has an "strong is-a" relationship with Applet, and Applet
 * with it's parent and so-forth. Which means our applet1 inherited all
 * the methods and properties thorougout the hierarchical tree.
 *
 * One particular overridden method 'paint' is inherited from the
 * java.awt.Component class. The paint method has one parameter 'Graphics'
 * which according to the Java documentation "Programs must use this Graphics
 * object (or one derived from it) to render output. They are free to change
 * the state of the Graphics object as necessary."
 *
 * As implemented, the relationship between applet1 and the Graphics object
 * appears to be associative. The class applet1 does not have a property to
 * retain a reference to the Graphics object, and therefore does not have
 * a 'has-a' relationship (composition).
 *
 * Further more, the lifetime of applet1 and the Graphics object are different.
 * The applet object lives even if the paint method isn't invoked. The applet
 * is dependent on the Graphics object to function properly, but are truly
 * independent objects. I believe this is a special form of association
 * called 'dependency.'
 *
 * Our applet1 class has complete custody of this Graphics object. Custody is
 * neither shared nor passed to another Applet class. Each applet has it's
 * own instance of the Graphics object, and therefore renders it's own
 * graphics component.
 *
 * After looking at the implementation, lifetime and custody, I would have to
 * say the relationship between applet1 and Graphics is an associative
 * 'uses-a' relationship. The Applet uses-a Graphics component to render
 * the graphic display within the applet viewer window.
 *
 * @author  John Thomason
 * Course:  CS222 Java II
 * Seminar: 5
 * Assign:  3
 *
 */
import java.awt.*;
import java.applet.*;

 // new class extended from Applet superclass
public class applet1 extends Applet
{

    @Override
    public void paint(Graphics g)
    {
        setBackground(Color.BLUE);
        g.setColor(Color.WHITE);
        g.setFont(new Font(Font.SERIF,Font.PLAIN,14));
        g.drawString("Hello",15,20);
        g.drawString("From Your Instructor",15,40);
        g.drawString("Sofia Saleem",15,60);
        g.setFont(new Font(Font.SANS_SERIF,Font.BOLD,14));
        g.drawString("Editor: John Thomason", 15,85);

    }
}